﻿using DynamicProxy.Core;
using DynamicProxy.Core.AutoProxy;
using System;
using System.Collections.Generic;
using System.Text;

namespace DynamicProxy.AOP
{
    /// <summary>
    /// 前拦截器
    /// </summary>
    [AttributeUsage(AttributeTargets.Method)]
    public abstract class AOPBeforeAttribute : RewriteAttribute
    {
        protected Invocation invocation;

        public virtual AOPBeforeAttribute Fill(Invocation invocation)
        {
            this.invocation = invocation;
            return this;
        }

        /// <summary>
        /// 前切，若返回false不会执行其他前切和被拦截的方法，但会执行后切
        /// </summary>
        /// <returns></returns>
        public abstract bool BeforeExecute();
    }
}
